##Set WD
setwd("C:/Users/Macauley-Choque/Dropbox/POL 200")

##Packages
library(tidyr)
library(haven)
library(car)
library(plyr)
library(ggplot2)
library(stargazer)
library(arm)

##Import Data
library(readxl)
PPQ<- read_excel("Jeram PS Data F18.xlsx")
summary(PPQ)

##Make numeric variables
PPQ$`1_A`<-as.numeric(PPQ$`1_A`)
PPQ$`1_B`<-as.numeric(PPQ$`1_B`)
PPQ$`1_C`<-as.numeric(PPQ$`1_C`)
PPQ$`1_D`<-as.numeric(PPQ$`1_D`)
PPQ$`1_E`<-as.numeric(PPQ$`1_E`)
PPQ$`1_F`<-as.numeric(PPQ$`1_F`)
PPQ$`1_G`<-as.numeric(PPQ$`1_G`)
PPQ$`1_H`<-as.numeric(PPQ$`1_H`)
PPQ$`1_I`<-as.numeric(PPQ$`1_I`)
PPQ$`1_J`<-as.numeric(PPQ$`1_J`)
PPQ$`2_K`<-as.numeric(PPQ$`2_K`)
PPQ$`2_L`<-as.numeric(PPQ$`2_L`)
PPQ$`2_M`<-as.numeric(PPQ$`2_M`)
PPQ$`2_N`<-as.numeric(PPQ$`2_N`)
PPQ$`2_O`<-as.numeric(PPQ$`2_O`)
PPQ$`2_P`<-as.numeric(PPQ$`2_P`)
PPQ$`2_Q`<-as.numeric(PPQ$`2_Q`)
PPQ$`2_R`<-as.numeric(PPQ$`2_R`)
PPQ$`2_S`<-as.numeric(PPQ$`2_S`)
PPQ$`2_T`<-as.numeric(PPQ$`2_T`)

##summary stats
library(psych)
describe(PPQ)

##means
means<-data.frame(sum$mean)

#paired t-test of like scores
tt1 <- t.test(PPQ$`1_A`, PPQ$`2_K`, paired = TRUE)
tt1

tt2 <- t.test(PPQ$`1_B`, PPQ$`2_L`, paired = TRUE)
tt2

tt3 <- t.test(PPQ$`1_C`, PPQ$`2_M`, paired = TRUE)
tt3

tt4 <- t.test(PPQ$`1_D`, PPQ$`2_N`, paired = TRUE)
tt4

tt5 <- t.test(PPQ$`1_E`, PPQ$`2_O`, paired = TRUE)
tt5

tt6 <- t.test(PPQ$`1_F`, PPQ$`2_P`, paired = TRUE)
tt6

tt7 <- t.test(PPQ$`1_G`, PPQ$`2_Q`, paired = TRUE)
tt7

tt8 <- t.test(PPQ$`1_H`, PPQ$`2_R`, paired = TRUE)
tt8

tt9 <- t.test(PPQ$`1_I`, PPQ$`2_S`, paired = TRUE)
tt9

tt10 <- t.test(PPQ$`1_J`, PPQ$`2_T`, paired = TRUE)
tt10

##p-values
tt1$p.value
tt2$p.value
tt3$p.value
tt4$p.value
tt5$p.value
tt6$p.value
tt7$p.value
tt8$p.value
tt9$p.value
tt10$p.value


